// 获取品牌属性信息
import request from '@/utils/request'

// 品牌属性一级，/admin/product/getCategory1， get
export const reqgetCategory1List = () => request({
    url: '/admin/product/getCategory1',
    method: 'get'
})

// 品牌属性二级，/admin/product/getCategory2/{category1Id}， get
export const reqgetCategory2List = (category1Id) => request({
    url: `/admin/product/getCategory2/${category1Id}`,
    method: 'get'
})

// 品牌属性三级，/admin/product/getCategory3/{category2Id}， get
export const reqgetCategory3List = (category2Id) => request({
    url: `/admin/product/getCategory3/${category2Id}`,
    method: 'get'
})

// 通过三级联动获取品牌信息， /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}， get
export const reqgetCategoryInfoList = (category1Id, category2Id, category3Id) => request({
    url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
    method: 'get'
})

// 添加或修改品牌属性, /admin/product/saveAttrInfo, post
export const reqsaveAttrInfo = (data) => request({
    url: '/admin/product/saveAttrInfo',
    method: 'post',
    data
})
/*
{
  "attrName": "",      属性名
  "attrValueList": [   属性名中属性值，因为属性值可以是多个，因此需要的是数组
    {
      "attrId": 0,          属性的id
      "valueName": "string"  属性值
    }
  ],
  "categoryId": 0,    category3Id
  "categoryLevel":3,
}
*/

// 删除属性， DELETE /admin/product/deleteAttr/{attrId}
export const reqdeleteAttr = (attrId) => request({
  url: `/admin/product/deleteAttr/${attrId}`,
  method: 'delete'
})
